﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using Caliburn.Micro;
using SS.WPF.Framework.Display.FileDialog;
using SS.WPF.Framework.Display.MsgBox;
using Action = System.Action;

namespace SS.WPF.Framework.Display.Dialog
{
    /// <summary>
    /// The interface that is used to manage dialogs
    /// </summary>
    public interface IDialogManager
    {
        /// <summary>
        /// Show modal dialog
        /// </summary>
        /// <typeparam name="T">
        /// The type of model
        /// </typeparam>
        bool? ShowDialog<T>() where T : class;

        /// <summary>
        /// Show modal dialog
        /// </summary>
        /// <param name="input">The dialog view model or dialog view</param>
        bool? ShowDialog(object input);

        /// <summary>
        /// Show modal dialog
        /// </summary>
        /// <param name="rootModel"></param>
        /// <param name="context"></param>
        /// <param name="owner"></param>
        /// <returns></returns>
        bool? ShowDialog(object rootModel, object context, object owner);

        /// <summary>
        /// Show message box
        /// </summary>
        /// <param name="info">Message box information</param>
        /// <returns>The shown result</returns>
        MsgBoxResult ShowMessageBox(MsgBoxInfo info);

        /// <summary>
        /// Show progress dialog
        /// </summary>
        /// <param name="caption"></param>
        /// <param name="message"></param>
        /// <param name="job"></param>
        /// <param name="owner"></param>
        /// <param name="sender"></param>
        /// <param name="onCmpleted"></param>
        void ShowProgressDialog(string caption, string message, DoWorkEventHandler job,
            object owner, object sender, Action onCmpleted = null);

        /// <summary>
        /// Shows the open file dialog box that allows a user to specify a file that should be opened.
        /// </summary>
        /// <param name="fileTypes">The supported file types.</param>
        /// <param name="defaultFileType">Default file type.</param>
        /// <param name="defaultFileName">Default filename. The directory name is used as initial directory when it is specified.</param>
        /// <param name="title">Title</param>
        /// <returns>A FileDialogResult object which contains the filename selected by the user.</returns>
        /// <exception cref="ArgumentNullException">fileTypes must not be null.</exception>
        /// <exception cref="ArgumentException">fileTypes must contain at least one item.</exception>
        FileDialogResult ShowOpenFileDialog(IEnumerable<FileType> fileTypes, FileType defaultFileType,
                                            string defaultFileName, string title);

        /// <summary>
        /// Shows the save file dialog box that allows a user to specify a filename to save a file as.
        /// </summary>
        /// <param name="fileTypes">The supported file types.</param>
        /// <param name="defaultFileType">Default file type.</param>
        /// <param name="defaultFileName">Default filename. The directory name is used as initial directory when it is specified.</param>
        /// <param name="title">Title</param>
        /// <returns>A FileDialogResult object which contains the filename entered by the user.</returns>
        /// <exception cref="ArgumentNullException">fileTypes must not be null.</exception>
        /// <exception cref="ArgumentException">fileTypes must contain at least one item.</exception>
        FileDialogResult ShowSaveFileDialog(IEnumerable<FileType> fileTypes, FileType defaultFileType,
                                            string defaultFileName, string title);
    }
}
